package com.itheima;

public class Topic11 {

    public static int maxArea(int[] height) {
        int max = 0;
        int a = 0; //左指针
        int b = height.length - 1; //右指针

        while(a < b) {
            max = Math.max(max, Math.min(height[a], height[b]) * (b - a));
            if (height[a] < height[b]) {
                a++;
            } else {
                b--;
            }
        }

        return max;
    }

    public static void main(String[] args) {
//
        int a = Topic11.maxArea(new int[]{1,8,6,2,5,4,8,3,7});
    }
}
